#include <iostream>
using namespace std;

int main()
{
	int l, r, count = 0;
	cin >> l >> r;
	while(l <= r)
	{
		int n = l;
		while(n)
		{
			if(n % 10 == 2)
				count++;
			n /= 10;
		}
		l++;
	}
	cout << count << endl;
	return 0;
}
